using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// User_Sub - 订阅表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IUserSub<T> :ModelBase<UserSub> where T : UserSub, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.UserId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return UserId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.UserId=dy.UserId;
           this.IsBBs=dy.IsBBs;
           this.IsBlog=dy.IsBlog;
           this.IsFile=dy.IsFile;
           this.IsWiki=dy.IsWiki;
           this.IsKnow=dy.IsKnow;
           this.IsMy=dy.IsMy;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 用户ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 用户ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 是否开启论坛新帖通知
        /// </summary>
        private int _IsBBs =-1;
      
        /// <summary>
        /// 是否开启论坛新帖通知
        /// </summary>
        public yq.Enums.BooleanType IsBBs
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsBBs; 
            }

            set 
            {
                    _IsBBs= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否开启新博客通知
        /// </summary>
        private int _IsBlog =-1;
      
        /// <summary>
        /// 是否开启新博客通知
        /// </summary>
        public yq.Enums.BooleanType IsBlog
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsBlog; 
            }

            set 
            {
                    _IsBlog= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否开启新文档通知
        /// </summary>
        private int _IsFile =-1;
      
        /// <summary>
        /// 是否开启新文档通知
        /// </summary>
        public yq.Enums.BooleanType IsFile
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsFile; 
            }

            set 
            {
                    _IsFile= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否开启维基通知
        /// </summary>
        private int _IsWiki =-1;
      
        /// <summary>
        /// 是否开启维基通知
        /// </summary>
        public yq.Enums.BooleanType IsWiki
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsWiki; 
            }

            set 
            {
                    _IsWiki= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否开启知道通知
        /// </summary>
        private int _IsKnow =-1;
      
        /// <summary>
        /// 是否开启知道通知
        /// </summary>
        public yq.Enums.BooleanType IsKnow
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsKnow; 
            }

            set 
            {
                    _IsKnow= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否开启他人对我评论的通知
        /// </summary>
        private int _IsMy =-1;
      
        /// <summary>
        /// 是否开启他人对我评论的通知
        /// </summary>
        public yq.Enums.BooleanType IsMy
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsMy; 
            }

            set 
            {
                    _IsMy= value.GetHashCode(); 
            }
        }
       
     
      
       

      #endregion 定义属性 

          protected internal override void SetValue(UserSub info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["IsBBs"]!= DBNull.Value)
                  {
                  info.IsBBs= (yq.Enums.BooleanType)(row["IsBBs"]) ;
                 }
                 
                  
                  if(row["IsBlog"]!= DBNull.Value)
                  {
                  info.IsBlog= (yq.Enums.BooleanType)(row["IsBlog"]) ;
                 }
                 
                  
                  if(row["IsFile"]!= DBNull.Value)
                  {
                  info.IsFile= (yq.Enums.BooleanType)(row["IsFile"]) ;
                 }
                 
                  
                  if(row["IsWiki"]!= DBNull.Value)
                  {
                  info.IsWiki= (yq.Enums.BooleanType)(row["IsWiki"]) ;
                 }
                 
                  
                  if(row["IsKnow"]!= DBNull.Value)
                  {
                  info.IsKnow= (yq.Enums.BooleanType)(row["IsKnow"]) ;
                 }
                 
                  
                  if(row["IsMy"]!= DBNull.Value)
                  {
                  info.IsMy= (yq.Enums.BooleanType)(row["IsMy"]) ;
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, UserSub info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@IsBBs", DbType.Int32,ParameterTool.GetObj( info._IsBBs )); 
            
             
                cn.AddInParameter(comm, "@IsBlog", DbType.Int32,ParameterTool.GetObj( info._IsBlog )); 
            
             
                cn.AddInParameter(comm, "@IsFile", DbType.Int32,ParameterTool.GetObj( info._IsFile )); 
            
             
                cn.AddInParameter(comm, "@IsWiki", DbType.Int32,ParameterTool.GetObj( info._IsWiki )); 
            
             
                cn.AddInParameter(comm, "@IsKnow", DbType.Int32,ParameterTool.GetObj( info._IsKnow )); 
            
             
                cn.AddInParameter(comm, "@IsMy", DbType.Int32,ParameterTool.GetObj( info._IsMy )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 